package jubuneibulei;

public class Student {


    //属性-----成员变量

    private static String stuName;//静态方法
    private  String stuNum;
    private  Integer stuAge;

    //getter和setter接口
    public String getStuName() { return stuName; }

    public String getStuNum() {
        return stuNum;
    }

    public Integer getStuAge() {
        return stuAge;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public void setStuAge(Integer stuAge) {
        this.stuAge = stuAge;
    }

    /**
     *    外部类的行为
     */
    //默认构造方法
    public Student(){
        System.out.println("--Student外部类的默认构造方法");
    }
    //自定义构造方法
    public  Student(String stuName,String stuNum ,Integer stuAge){
        this.stuName = stuName;
        this.stuNum = stuNum;
        this.stuAge = stuAge;
        System.out.println("姓名："+stuName+"学号："+stuNum+"年龄"+stuAge);
        System.out.println("--Student外部类的自定义构造方法");
    }

    //行为
    public void doStuding(){
        //局部变量
        String schoolname = "tjise";
        /**
         * 如果局部内部类访问了外部的局部变量，则该局部变量需要为final类型或者是等效【不能修改值】
         * jdk1.8-之前要求必须显示写出final修饰符；jdk1 .8以后可以不用写，但是不能改变这个被访问的局部变量的值
         */

        //修改学校的名字
        //schoolname = "工业大学";

        class StuFamily {

            //成员内部类属性
            private String stuMotherName;
            private String stuFatherName;
            private Integer stuFamilyPhone;


            //成员内部类的getter和setter接口方法
            public String getStuMotherName() {
                return stuMotherName;
            }

            public String getStuFatherName() {
                return stuFatherName;
            }

            public Integer getStuFamilyPhone() {
                return stuFamilyPhone;
            }

            public void setStuMotherName(String stuMotherName) {
                this.stuMotherName = stuMotherName;
            }

            public void setStuFatherName(String stuFatherName) {
                this.stuFatherName = stuFatherName;
            }

            public void setStuFamilyPhone(Integer stuFamilyPhone) { this.stuFamilyPhone = stuFamilyPhone;}


            //默认构造方法
            public  StuFamily(){   System.out.println("--StuFamily静态内部类的默认构造方法");}

            //三个参数的成员内部类自定义构造方法
            public  StuFamily(String stuMotherName,String stuFatherName,Integer stuFamilyPhone){
                this.stuMotherName = stuMotherName;
                this.stuFatherName = stuFatherName;
                this.stuFamilyPhone = stuFamilyPhone;
                System.out.println("妈妈的姓名："+stuMotherName+"爸爸的姓名："+stuFatherName+"电话号码"+stuFamilyPhone);
                System.out.println("--StuFamily静态内部类的自定义构造方法");
            }

            public void printFamilyInfo(){
                System.out.println("学生学校姓名："+schoolname);// 静态内部类只能访问静态的对象
                System.out.println("--局部内部类只能访问外部类的局部变量--");
                System.out.println("学生的家庭信息：");
            }
        }

        //局部变量的作用域范围，可以使用局部内部类
        StuFamily stuFamily = new StuFamily();
        stuFamily.printFamilyInfo();
        System.out.println(this.stuName+"is studing................");
        }


}
